from pydantic import BaseModel
import toml


class _Server(BaseModel):
    host: str
    port: int

class _Log(BaseModel):
    default_fmt : str
    date_fmt : str
    access_fmt : str

class _Database(BaseModel):
    url: str


class _Config(BaseModel):
    server: _Server
    log: _Log
    database: _Database



toml_path = "config/config.toml"
Config = _Config(**toml.load(toml_path))

ServerConfig = Config.server
LogConfig = Config.log
DatabaseConfig = Config.database


